/**
 *
 * 文件命名格式：zmn.模块名称.表名称.功能.jas
 * @author duanzucai
 * @date 2018/11/10
 */
layui.define(['index', 'form', 'table', 'laypage', 'layedit', 'laydate', 'jquery'], function (exports) {
    var $ = layui.$;
    var table = layui.table;
    var laypage = layui.laypage;
    var laydate = layui.laydate;
    var form = layui.form;
    table.init('zmn-table', {
        toolbar: "#zmn-table-tool",
        page: true,
        limit: json.pageSize,
        height: 'full-140'
    });

    laypage.render(zmnPage.laypageOptions(json));
    form.on('submit(zmn-form-reset)', function (obj) {
        form.val("zmn-form-filter", {
            "keyword": ""
        });
        return false;
    });
    var ids = new Array();

    // 选择（全选或单选）
    table.on("checkbox(zmn-table)", function () {
        ids = table.checkStatus('zmn-table').data.map((item) => item.robotId);
    });

   /* // 修改排序
    table.on("edit(zmn-table)", function (obj) {
        zmnPage.laySort(obj, "/brs/ding/group/robot/updateSort.action", obj.data.robotId);
    });

    // 启用/停用
    table.on("toolbar(zmn-table)", function (obj) {
        if (obj.event != "start" && obj.event != "stop") {
            return;
        }
        if (ids.length === 0) {
            return layer.alert("请选择至少一条数据！");
        }
        zmnPage.layStartStop(obj, "/brs/ding/group/robot/updateStatus.action", ids.join(","));
    });
*/
    //对外暴露的接口
    exports('brs_ding_group_robot_list', {});
});

function detail(id) {
    var title = "新增钉钉群";
    if (id != null) {
        title = "修改钉钉群";
    } else {
        id = 0;
    }
    layer.open({
        type: 2,
        title: title,
        shadeClose: true,
        shade: false,
        maxmin: true, //开启最大化最小化按钮
        area: ['750px', '300px'],
        content: '/ding/group/robot/detail.action?robotId=' + id
    });
}

/**
 * 关闭窗口
 */
function closeWin(refTag) {
    layer.closeAll();
    if (refTag) {
        location.reload();
    }
}